package com.sky.mapper.admin;

import com.github.pagehelper.Page;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.pojo.Setmeal;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealMapper {


    /**
     * 查询套餐关联分类
     * @param id
     * @return
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    /**
     * 新增套餐
     * @param setmeal
     */
    void insert(Setmeal setmeal);


    /**
     * 套餐分页查询
     * @param setmealPageQueryDTO
     * @return
     */
    Page<SetmealVO> page(SetmealPageQueryDTO setmealPageQueryDTO);

    /**
     * 根据id查询套餐
     * @param id
     * @return
     */
    @Select("select * from setmeal where id=#{id}")
    Setmeal selectById(Long id);

    /**
     * 根据id删除
     * @param id
     */
    @Delete("delete from setmeal where id=#{id}")
    void deleteById(Long id);


    @Select("select * from setmeal where id=#{id}")
    SetmealVO getById(Long id);

    void update(Setmeal setmeal);

    @Select("select * from setmeal where category_id=#{categoryId} and status=1")
    List<Setmeal> setmealListByCategoryId(Integer categoryId);


    List<DishItemVO> getDishItemById(Integer id);

    Integer getStatus(Map map);
}
